package com.nerve.secondhandcar.domain.report;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.nerve.secondhandcar.domain.Car;
import com.nerve.secondhandcar.domain.Evaluators;
import com.nerve.secondhandcar.domain.car.CarChild;

/**
 * @project: secondHandCarPlatform
 * @file: Report.java
 * @package: com.nerve.secondhandcar.domain.report
 * @description:
 *	测评报告
 * @author: 集成显卡	1053214511@qq.com
				IBM GDC, zengxm@cn.ibm.com
 * @date&time: 2014-10-10
 * @change log:
 */
@SuppressWarnings("serial")
@Entity
@Table(name="report")
public class Report extends CarChild{
	private int grade;						//最终定级
	private String level;					//骨架得分
	private int score;						//总分
	private int scoreOut;					//外观得分
	private int scoreIn;					//内饰得分
	private int scorePerform;
	private Date postDate;
	
	/**
	 * 新增4个属性	on 2015-1-19
	 */
	private String scorePerformResult;
	private String scoreInResult;
	private String scoreOutResult;
	private String levelResult;
	
	private Evaluators evaluators;
	
	private ReportPerform perform;
	private ReportDrive drive;
	private ReportSecurity security;
	private ReportTrouble trouble;
	private ReportPaint paint;
	
	public Report() {
	}
	
	public Report(Car car){
		this.perform = new ReportPerform();
		this.drive = new ReportDrive();
		this.security = new ReportSecurity();
		this.trouble = new ReportTrouble();
		this.paint = new ReportPaint();
	}
	
	@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
	@JoinColumn(name="paint_id", insertable=true)
	public ReportPaint getPaint() {
		return paint;
	}

	public void setPaint(ReportPaint paint) {
		this.paint = paint;
	}

	@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
	@JoinColumn(name="perform_id", insertable=true)
	public ReportPerform getPerform() {
		return perform;
	}

	public void setPerform(ReportPerform perform) {
		this.perform = perform;
	}

	@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
	@JoinColumn(name="drive_id", insertable=true)
	public ReportDrive getDrive() {
		return drive;
	}

	public void setDrive(ReportDrive drive) {
		this.drive = drive;
	}

	@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
	@JoinColumn(name="security_id", insertable=true)
	public ReportSecurity getSecurity() {
		return security;
	}
	
	public void setSecurity(ReportSecurity security) {
		this.security = security;
	}

	@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
	@JoinColumn(name="trouble_id", insertable=true)
	public ReportTrouble getTrouble() {
		return trouble;
	}

	public void setTrouble(ReportTrouble trouble) {
		this.trouble = trouble;
	}

	public int getGrade() {
		return grade;
	}

	public void setGrade(int grade) {
		this.grade = grade;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	public String getScorePerformResult() {
		return scorePerformResult;
	}

	public void setScorePerformResult(String scorePerformResult) {
		this.scorePerformResult = scorePerformResult;
	}

	public String getScoreInResult() {
		return scoreInResult;
	}

	public void setScoreInResult(String scoreInResult) {
		this.scoreInResult = scoreInResult;
	}

	public String getScoreOutResult() {
		return scoreOutResult;
	}

	public void setScoreOutResult(String scoreOutResult) {
		this.scoreOutResult = scoreOutResult;
	}

	public String getLevelResult() {
		return levelResult;
	}

	public void setLevelResult(String levelResult) {
		this.levelResult = levelResult;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public int getScoreOut() {
		return scoreOut;
	}

	public void setScoreOut(int scoreOut) {
		this.scoreOut = scoreOut;
	}

	public int getScoreIn() {
		return scoreIn;
	}

	public void setScoreIn(int scoreIn) {
		this.scoreIn = scoreIn;
	}

	public int getScorePerform() {
		return scorePerform;
	}

	public void setScorePerform(int scorePerform) {
		this.scorePerform = scorePerform;
	}

	public Date getPostDate() {
		return postDate;
	}

	public void setPostDate(Date postDate) {
		this.postDate = postDate;
	}

	@ManyToOne(fetch = FetchType.LAZY,cascade={CascadeType.REFRESH})
	@JoinColumn(name = "evaluators_id")
	public Evaluators getEvaluators() {
		return evaluators;
	}

	public void setEvaluators(Evaluators evaluators) {
		this.evaluators = evaluators;
	}
}